#pragma once

#include<d3d9.h>
#include<d3dx9.h>
#include<dxerr.h>

#define DIRECTINPUT_VERSION 0x0800
#include<dinput.h>
#include<windows.h>
#include <sstream>
#include <string>

#define SCREEN_WIDTH 1024
#define SCREEN_HEIGHT 768
#define BBUF_WIDTH SCREEN_WIDTH
#define BBUF_HEIGHT SCREEN_HEIGHT

#ifdef _DEBUG
#pragma comment(lib,"d3dx9d.lib")
#else
#pragma comment(lib,"d3dx9.lib")
#endif

#ifdef _DEBUG
#define D3D_DEBUG_INFO
#endif

namespace vertexInfo
{
	// Vertex declaration
	static const D3DVERTEXELEMENT9 VERTEX_FORMAT[] =
	{
		{0, 0 , D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
		{0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
		{0, 20, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
		{0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0},
		D3DDECL_END()
	};

	// Structures
	struct D3DVERTEX
	{
		D3DXVECTOR3 position;
		D3DXVECTOR2 texCoord;
		D3DXVECTOR3 normal;
		D3DXVECTOR3 tangent;

		D3DVERTEX(D3DXVECTOR3 position, D3DXVECTOR3 normal, D3DXVECTOR2 texCoord, D3DXVECTOR3 tangent):
		position(position), normal(normal), texCoord(texCoord), tangent(tangent)
		{}
	};
}

namespace commonValues
{
	const D3DXVECTOR4 halfPixel(0.5f/(float)SCREEN_WIDTH, 0.5f/(float)SCREEN_HEIGHT, 0.0f, 0.0f);
}

// Should load these automagically
// Textures
const LPCWSTR WATER_TEX = L"media\\textures\\water256x256-diff.png";
const LPCWSTR WATER_TEX_SPEC = L"media\\textures\\water256x256-spec.png";
const LPCWSTR BALL_TEX = L"media\\textures\\ball256x256-diff.png";
const LPCWSTR BALL_TEX_SPEC = L"media\\textures\\ball256x256-spec.png";
const LPCWSTR LIGHT_TEX = L"media\\textures\\light256x256.png";
const LPCWSTR MOUNTAIN_TEX = L"media\\textures\\beach-rock512x512-diff.png";
const LPCWSTR SKY_TEX = L"media\\textures\\heavy_messy.bmp";
const LPCWSTR PLAYER_TEX = L"media\\textures\\player512x512-diff.png";
const LPCWSTR PLAYER_TEX_SPEC = L"media\\textures\\player512x512-spec.png";
const LPCWSTR PROXY_TEX = L"media\\textures\\proxy512x512-diff.png";
const LPCWSTR PROXY_TEX_SPEC = L"media\\textures\\proxy512x512-spec.png";
// Models
const LPCWSTR MAIN_STAGE_X = L"media\\models\\super-sphere.x";
const LPCWSTR BOT_X = L"media\\models\\super-box.x";
const LPCWSTR SPHERE_LIGHT_X = L"media\\models\\sphere-light.x";
const LPCWSTR SKY_DOME_X = L"media\\models\\sky.x";
const LPCWSTR MOUNTAINS_X = L"media\\models\\mountains.x";
const LPCWSTR CONE_LIGHT_X = L"media\\models\\cone-light-tail-offset.x";
// Hlsl
const LPCWSTR GBUFFER_COMBINE_FX = L"shaders\\combineFinal.fx";
const LPCWSTR GBUFFER_CLEAR_FX = L"shaders\\deferred.fx";
const LPCWSTR DEF_DIRECTIONAL_LIGHT_FX = L"shaders\\directionalLight.fx";
const LPCWSTR GBUFFER_RENDER_FX = L"shaders\\renderGBuffer.fx";
const LPCWSTR DEF_POINT_LIGHT_FX = L"shaders\\pointLight.fx";
const LPCWSTR DEF_SPOT_LIGHT_FX = L"shaders\\spotLight.fx";
const LPCWSTR SHADOW_RENDER_FX = L"shaders\\shadowMap.fx";
const LPCWSTR BLUR_FX = L"shaders\\blur.fx";
const LPCWSTR GLOW_FX = L"shaders\\glow.fx";
const LPCWSTR DOF_FX = L"shaders\\dof.fx";
const LPCWSTR DRAW_QUAD_FX = L"shaders\\drawQuad.fx";
const LPCWSTR DEPTH_FX = L"shaders\\depth.fx";
const LPCWSTR DIFF_FX = L"shaders\\diffuse.fx";
